# 04-自动关闭文件.py
list = []
with open('./02-test.txt',"r",encoding="utf-8") as file:
    for x in file:
       # 去除换行符 x.rstrip() 返回不带\n字符
       list.append(x.rstrip())
print(list)
# with 声明打开文件 可以不手动关闭，会自动关闭